// AdBlockerUIDlg.h : header file
//

#pragma once
#include "afxcmn.h"
#include <afxmt.h>
#include <iostream>
#include <vector>
#include "notifyIcon.h"


#define CONFIG_FILE "./config.ini"
#define LIST_CONF "AdBlockerSetList"
#define COUNT_CONF "count"
#define MATCH_MODE "matchmode"



void* WINAPI MonitorThreadProc(LPVOID lpParam);
BOOL   CALLBACK   EnumChildProc(HWND hwnd,LPARAM lParam);

typedef struct tagSTWnd
{
	HWND hwnd;
	std::string wndTitle;
}STWnd,*pSTWnd;


// CAdBlockerUIDlg dialog
class CAdBlockerUIDlg : public CDialog
{
// Construction
public:
	CAdBlockerUIDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	enum { IDD = IDD_ADBLOCKERUI_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	virtual BOOL OnInitDialog();
	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedOk();
	afx_msg void OnBnClickedDec();
	afx_msg void OnBnClickedAdd();
private:
	CListCtrl m_listCtrl;
	int InitList();
	int AfterDecListCtrl();

	std::vector<STWnd>   m_vecStrWnd;

	int AddItem2Vec(std::string s);
	int DecItem2Vec(std::string s);
	
	int ReadConfig(char *confPath);
	int SaveData2Cof(char *conf);
	
	int ShieldWnd(std::vector<STWnd> &v);
	int GetAllTopWnd(std::vector<STWnd> &v);
	bool IsHave(char *s);

	CNotifyIcon *m_pNotify;
public:
	afx_msg void OnTimer(UINT_PTR nIDEvent);

protected:
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
public:
	afx_msg void OnBnClickedCancel();
	afx_msg void OnBnClickedButton1();
	afx_msg void OnShow();
	afx_msg void OnMenuExit();
};
